package com.edu.controller;

import com.edu.dao.ProductCategoryDao;
import com.edu.dao.impl.MyBatisProductCatrgoryDaoImpl;
import com.edu.data.News;
import com.edu.data.ProductCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("/category")
public class EasyBuyCategoryController {
    @Autowired
    ProductCategoryDao category;

    @RequestMapping("/main")
    public String mainNews(Model model, HttpServletRequest req){
        List<ProductCategory> productCategoryList = category.getList();
        model.addAttribute("categories",productCategoryList);
        return "leftbar";
    }
}
